﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Reflection;
using System.IO;

namespace Generator.Tools
{
    public partial class PDBReader : Form
    {
        public PDBReader()
        {
            InitializeComponent();
        }


        private void LoadAssembly(string partialName)
        {
            using (var fs = File.OpenRead(partialName))
            {
                StreamReader sr = new StreamReader(fs,Encoding.ASCII);

                string t = sr.ReadToEnd();
                richTextBox1.AppendText(t);

                //string t = string.Empty;

                //while (fs.Position<fs.Length)
                //{
                //    t = sr.ReadLine();
                //    richTextBox1.AppendText(t);
                //    richTextBox1.AppendText(Environment.NewLine);
                //}
                sr.Close();
            }

        }



        private void textBox2_KeyDown(object sender, KeyEventArgs e)
        {
        }


        private void button2_Click(object sender, EventArgs e)
        {
            LoadAssembly(textBox2.Text);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            var res = openFileDialog1.ShowDialog();
            if (res == DialogResult.OK)
            {
                textBox2.Text = openFileDialog1.FileName;
                LoadAssembly(textBox2.Text);
            }
        }
    }
}
